#include <iostream>
#define N 1000
using namespace std;
int stu_no[N]= {0};
int main_50()
{
    int n,m,p,q,start,stop,temp;
    cin>>n>>m;
    for (int i=0; i<n ; i++ )
    {
        stu_no[i]=i+1;
    }
    for (int j=0; j<m ; j++ )
    {
        cin>>p>>q;
        for (int j=0; j<n ; j++ )
        {
            if (stu_no[j]==p)
            {
                start=j;
                break;
            }
        }
        stop=start+q;
        temp=stu_no[start];
        if (q>0)
        {
            for (int k=start; k<stop ; k++ )
            {
                stu_no[k]=stu_no[k+1];
            }
        }
        else
        {
            for (int k=start; k>stop ; k-- )
            {
                stu_no[k]=stu_no[k-1];
            }

        }
        stu_no[stop]=temp;
    }
    for (int l=0; l<n ; l++ )
    {
        cout << stu_no[l] << " ";
    }
    return 0;
}
